home *** CD-ROM | disk | FTP | other *** search
/ Shareware Grab Bag / Shareware Grab Bag.iso / 090 / byteibm.arc / WILTON.ARC / CSLS6.ASM < prev    next >
Encoding:
Assembly Source File  |  1985-07-12  |  3.3 KB  |  142 lines

  1.             title    'extended character set for the EGA'
  2.             name    csls6
  3.             page    55,132
  4.  
  5. ;
  6. ; RAM-Loadable Character Sets for the IBM PC
  7. ; Listing 6
  8. ;
  9. ; Richard Wilton
  10. ; July 1986
  11. ;
  12.  
  13. ; Notes:
  14. ;    This program makes available two different 256-character definition
  15. ;    tables for use in enhanced alphanumeric video display modes.  The
  16. ;    program assumes that the proper video mode has already been
  17. ;    established.
  18. ;
  19. ;    You must have at least 128K of RAM on your EGA to use this program.
  20. ;
  21. ;    For IBM Enhanced Graphics Adapter ONLY.  You should have a 350-line
  22. ;    display to see the different character sizes.
  23.  
  24.  
  25. cset0    equ    0            ; character generator RAM bank #'s
  26. cset1    equ    1
  27.  
  28.  
  29. cseg    segment para public 'CODE'
  30.  
  31.     assume    cs:cseg,ds:cseg
  32.  
  33.     org    100h            ; initial program counter for .COM file
  34.  
  35. ; 1st 256 characters are 9x14 ROM characters (default for 350-line display)
  36. label0:    mov    bl,cset0        ; indicate bank 0 of char generator RAM
  37.                     ;  (A000:0000 in bit plane 2)
  38.     mov    al,1            ; indicate 8x14 ROM characters
  39.     mov    ah,11h
  40.     int    10h            ; call BIOS to load character table
  41.  
  42. ; 2nd 256 characters are 8x8 ROM character set
  43.     mov    bl,cset1        ; indicate bank 1 of char gen RAM
  44.                     ;  (A000:4000 in bit plane 2)
  45.     mov    al,2            ; indicate 8x8 ROM characters
  46.     mov    ah,11h
  47.     int    10h
  48.  
  49. ; Enable attribute bit 3 selection of character set
  50.     mov    bl,(cset1 shl 2)+cset0    ; BL := value for Sequencer Character
  51.                     ;  Map Select register
  52.     mov    al,3            ; "set block specifier"
  53.     mov    ah,11h
  54.     int    10h            ; call BIOS to program Sequencer
  55.  
  56. ; Disable bit 3 of attribute byte for palette selection
  57.     mov    bh,7            ; bit mask
  58.     mov    bl,12h            ; Attribute Controller: Color Plane
  59.                     ;  Enable register number
  60.     mov    al,0            ; "individual palette register"
  61.     mov    ah,10h
  62.     int    10h            ; call BIOS to set register
  63.  
  64. ; Display a message
  65.     push    cs    
  66.     pop    ds
  67.  
  68.     mov    si,offset csmsg0
  69.     mov    bl,7            ; bit 3 of attribute = 0
  70.     mov    cx,25            ; length of string
  71.     call    show            ; display string using char set 0
  72.  
  73.  
  74.     mov    si,offset csmsg1
  75.     mov    bl,0Fh            ; bit 3 of attribute = 1
  76.     mov    cx,25
  77.     call    show            ; display string using char set 1
  78.  
  79. ; Exit to DOS
  80.     mov    ax,4C00h
  81.     int    21h
  82.  
  83.  
  84.  
  85. ; Subroutine which displays a string using a given attribute
  86.  
  87. show    proc    near            ; Caller:    DS:SI -> string
  88.                     ;        CX = length of string
  89.                     ;        BL = attribute
  90.     jcxz    show2
  91.  
  92. show1:    lodsb                ; AL := next char
  93.     push    cx
  94.     push    bx
  95.     call    emit            ; display this character
  96.     pop    bx
  97.     pop    cx
  98.     loop    show1
  99.  
  100. show2:    ret
  101.  
  102. show    endp
  103.  
  104.  
  105. ; Subroutine which displays a single character using a given attribute
  106.  
  107. emit    proc    near            ; Caller:    AL = character
  108.                     ;        BL = attribute
  109.                     ; Returns:    nothing, but advances
  110.                     ;         the cursor
  111.     push    bx
  112.     push    cx
  113.  
  114.     cmp    al,20h
  115.     jb    emit1            ; jump if control character
  116.  
  117.     push    ax            ; save char on stack
  118.     mov    cx,1            ; CX := # of chars to write
  119.     mov    bh,0            ; BH := video display page 0
  120.     mov    ah,9            ; call BIOS to write attribute and
  121.     int    10h            ;  character at cursor
  122.     pop    ax            ; AL := character
  123.  
  124. emit1:    mov    ah,0Eh            ; call BIOS to rewrite character in
  125.     int    10h            ;  "teletype mode" which advances
  126.                     ;  the cursor
  127.     pop    cx
  128.     pop    bx
  129.     ret
  130.  
  131. emit    endp
  132.  
  133.  
  134. ; Strings to be displayed
  135.  
  136. csmsg0    db    'This is character set 0',0Dh,0Ah
  137. csmsg1    db    'This is character set 1',0Dh,0Ah
  138.  
  139. cseg    ends
  140.  
  141.     end    label0
  142.